package com.film.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.film.domain.Film;
import com.film.service.FilmService;
import com.film.service.impl.FilmServiceImpl;
/**
 * 该控制类用来做首页的信息访问
 * @author 2119196781
 *
 */
@WebServlet("/index")
public class IndexController extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		FilmService filmService = new FilmServiceImpl();
		//热门电影
		List<Film> hotFilm = filmService.selectHotFilm();
		session.setAttribute("hotFilm", hotFilm);
			
		//冷门电影
		List<Film> showFilm = filmService.selectShowFilm();
		session.setAttribute("showFilm", showFilm);
		response.sendRedirect("film.jsp");
	}
}
